﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace IndexMarkSilverlightClient.Classes
{
    public class YesNoToFloatConverter : IValueConverter
    {
         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)  
         {
             if ((string)value == "да")
             {
                 return 1;
             }
             else
             {
                 return 0;
             }             
         }  
       
         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
         {
             float val = (float)value;
             if (val == 1)
             {
                 return "да";
             }
             else
             {
                 return "нет";
             }
        }
    } 
}

